package channel

import (
	"errors"
)

var (
	ErrChannelNotSupport = errors.New("channel not support")
	ErrNodeNotFound      = errors.New("channel node not found")
	ErrChannelInvalid    = errors.New("channel invalid")
	ErrChannelBusy       = errors.New("channel busy")
)

type ChannelID uint32
type EntryID uint32
type ChannelInfo struct {
	Status     string
	Type       string
	EntryInfos map[EntryID][]uint32
}

type Channel interface {
	Put([]byte) error
	Get() ([]byte, error)
	Topic() string
	Type() bool
	Start() error
	Stop() error
}

type ChannelEntry interface {
	ID() EntryID
	DevID() uint32
	ConnID() uint32
	Transmit([]byte) error
	Receive() ([]byte, error)
}

type ChannelManager interface {
	ChannelNodeCreate(ctrl Channel) (ChannelID, error)
	ChannelNodeDestroy(chanID ChannelID) error
	ChannelNodeAddEntry(chanID ChannelID, entry ChannelEntry) error
	ChannelNodeDeleteEntry(chanID ChannelID, entry ChannelEntry) error
	ChannelEnable(chanID ChannelID) error
	ChannelDisable(chanID ChannelID) error
	ChannelCheck() (map[ChannelID]*ChannelInfo, error)
}
